import json

import requests  # 配置北向用户信息及北向地址nbi_name = "campus02@north.com"
from urllib3.exceptions import InsecureRequestWarning

from DjangoDemo.scripts import SiteID
from DjangoDemo.scripts.Http_Management import Http_Management
from DjangoDemo.scripts.Token import Token


class c2_1:
    def __init__(self, site_name):


        self.site_name = SiteID.Sites.get_mac(site_name)

        # 定义接口的 URI
        POST_LiST_URI = "/rest/campusclientservice/v1/event/userlist"

        jBody = '''{ "level":"1", "tenantId":"default-organization-id", "startTime":"1623906000000",
            "endTime":"1624078800000", "id":"%s",
            "sortColumn":"totalcount", "currPage":"1", "pageSize":"200", "sortType":"desc" }''' % self.site_name
        self.token = Token()
        self.r = Http_Management(self.token).post(POST_LiST_URI, jBody)



if __name__ == '__main__':
    now = c2_1("Shenzhen")
    print(now.r.json())
